package wicketcool.model.method;

import wicketcool.model.WCLAnnotation;
import wicketcool.model.WCLModifier;
import wicketcool.model.types.WCLType;

import java.util.ArrayList;
import java.util.List;

/**
 * User: rabbit
 * Date: Aug 3, 2009
 */
public class WCLMethod {

    private final String name;
    private final WCLType type;
    private final WCLModifier modifier;

    private final List<WCLAnnotation> annotations = new ArrayList<WCLAnnotation>();

    private WCLMethodBody body;

    public WCLMethod(String name, WCLType type, WCLModifier modifier) {
        this.name = name;
        this.type = type;
        this.modifier = modifier;
    }

    public void initMethodBody() {
        this.body = new WCLMethodBody();
    }

    public String getName() {
        return name;
    }

    public WCLType getType() {
        return type;
    }

    public WCLModifier getModifier() {
        return modifier;
    }

    public void addAnnotation(WCLAnnotation annotation) {
        annotations.add(annotation);
    }

    public List<WCLAnnotation> getAnnotations() {
        return annotations;
    }

    public WCLMethodBody getBody() {
        return body;
    }

    public boolean hasBody() {
        return body != null;
    }
}
